
*	************************************************************************
* 	File-Name: 		EESP_2014_CorruptionBrazil_replication.do
*	Date:  			25 December 2013
*	Authors: 		Michael Aklin, Patrick Bayer, S.P. Harish, and Johannes Urpelainen
*	Journal:		Environmental Economics and Policy Studies
* 	Paper:			Who Blames Corruption for the Poor Enforcement of Environmental Laws?
*					Survey Evidence from Brazil
*
*	Data Used:  	CorruptionBratzil.dta	
*	Purpose:   		.do file for replication
*	Software:		Stata IC 12.1
*	Machine:		WINDOWS 7
*
*	************************************************************************

clear all

* NB: Please place .do file and data in the same folder
use "./CorruptionBrazil.dta"

set more off, permanently


*	************************************************************************
*	(I) MAIN TEXT
*	************************************************************************

*	************************************************************************
*	1. Summary statistics
*	************************************************************************

tab q9
tab q9, nolabel

gen badlaws = q9
label variable badlaws "Bad Laws"
replace badlaws = 1 if q9 == 1
replace badlaws = 0 if q9 != 1 & q9 != .

gen ineffoversight = q9
label variable ineffoversight "Inefficient Oversight"
replace ineffoversight = 1 if q9 == 2
replace ineffoversight = 0 if q9 != 2 & q9 != .

gen others = q9
label variable others "Other Options"
replace others = 1 if q9 == 4 | q9 == 5 | q9 == 6 | q9 == 7 | q9 == .
replace others = 0 if q9 == 1 | q9 == 2 | q9 == 3

estpost summarize age educ income female q6 q8 corrupt badlaws ineffoversight others


*	************************************************************************
*	3. Main models
*	************************************************************************

* Main models with discrete dependent variable
eststo clear
eststo: logit corrupt income2 income3 income4 income5 educ2 educ3 age, robust
eststo: logit corrupt income2 income3 income4 income5 educ2 educ3 age female, robust
eststo: logit corrupt income2 income3 income4 income5 educ2 educ3 age female q6, robust
eststo: logit corrupt income2 income3 income4 income5 educ2 educ3 age female q6 q8, robust
eststo: xi: logit corrupt income2 income3 income4 income5 educ2 educ3 age female q6 q8 i.munic, robust
eststo: xi: logit corrupt income2 income3 income4 income5 educ2 educ3 age female q6 q8 i.munic i.state, robust


* Main models with continuous dependent variable
eststo clear
eststo: logit corrupt income educ age, robust
eststo: logit corrupt income educ age female, robust
eststo: logit corrupt income educ age female q6, robust
eststo: logit corrupt income educ age female q6 q8, robust
eststo: xi: logit corrupt income educ age female q6 q8 i.munic, robust
eststo: xi: logit corrupt income educ age female q6 q8 i.munic i.state, robust



*	************************************************************************
*	(II) APPENDIX
*	************************************************************************

*	************************************************************************
*	A2 -- Correlation matrix (Table A1)
*	************************************************************************

eststo clear
estpost corr corrupt educ age income female q6 q8, matrix

*	************************************************************************
*	A3 -- Weights (Table A2)
*	************************************************************************

* Create sampling weights
gen sweight = .
label variable sweight "Sampling Weight"

* Up to primary education
replace sweight = 36.75306966 if educ1==1 & income1==1
replace sweight = 1.79450851 if educ1==1 & income2==1
replace sweight = 20.77427790 if educ1==1 & income3==1
replace sweight = 144.20386939 if educ1==1 & income4==1
replace sweight = 422.09162156 if educ1==1 & income5==1

* Secondary education
replace sweight = 135.86206298 if educ2==1 & income1==1
replace sweight = 5.32163800 if educ2==1 & income2==1
replace sweight = 18.75434473 if educ2==1 & income3==1
replace sweight = 86.07617379 if educ2==1 & income4==1
replace sweight = 249.10072847 if educ2==1 & income5==1

* Academic degree
replace sweight = 556.68125147 if educ3==1 & income1==1
replace sweight = 37.07049878 if educ3==1 & income2==1
replace sweight = 28.99173272 if educ3==1 & income3==1
replace sweight = 52.43720562 if educ3==1 & income4==1
replace sweight = 86.69272510 if educ3==1 & income5==1


eststo clear
eststo: logit corrupt income educ age [pweight=sweight], robust
eststo: logit corrupt income educ age female [pweight=sweight], robust
eststo: logit corrupt income educ age female q6 [pweight=sweight], robust
eststo: logit corrupt income educ age female q6 q8 [pweight=sweight], robust
eststo: xi: logit corrupt income educ age female q6 q8 i.munic [pweight=sweight], robust
eststo: xi: logit corrupt income educ age female q6 q8 i.munic i.state [pweight=sweight], robust


*	************************************************************************
*	A4 -- Multinomial Analysis (Table A3)
*	************************************************************************

* Create new dependent variable
gen robustdv1 = .
label define robustlabels 0 "Others" 1 "Corruption" 2 "BadLaws" 3 "InefficientOversight"
label values robustdv1 robustlabels
replace robustdv1 = 1 if q9 == 3
replace robustdv1 = 2 if q9 == 1
replace robustdv1 = 3 if q9 == 2
replace robustdv1 = 0 if q9 == 4 | q9 == 5 | q9 == 6 | q9 == 7


* Robustness: Multinomoal Analysis (Table A3)
eststo clear
eststo: mlogit robustdv1 income educ, base(0) robust
eststo: mlogit robustdv1 income educ age, base(0) robust
eststo: mlogit robustdv1 income educ age female, base(0) robust
eststo: mlogit robustdv1 income educ age female i.munic, base(0) robust



*	************************************************************************
*	A5 -- Placebo (Table A5)
*	************************************************************************

eststo clear
eststo: reg q6_recode income age educ
eststo: reg q6_recode income age educ female
eststo: reg q6_recode income age educ female bad
eststo: reg q6_recode income age educ female bad q8
eststo: xi: reg q6_recode income age educ female bad q8 i.munic
eststo: xi: reg q6_recode income age educ female bad q8 i.munic i.state


*	************************************************************************
*	A6 -- Multicollinearity (Table A6)
*	************************************************************************

eststo clear
eststo: xi: reg corrupt income educ age female q6 q8 i.munic i.state, robust
estat vif
